const ajax = require('../../utils/ajax/ajax.js');
const util = require('../../utils/util.js');
Component({
    properties: {

    },
    data: {
        isArea: true,
        areaList: {}
    },
    lifetimes: {
        attached: function () {
            const that = this
            ajax.post({
                url: '/wx/getRegion',
                success(res) {
                    that.setData({
                        areaList: res.data
                    })
                },
                fail() {
                    util.toast('网络错误，请重试')
                }
            })
        }
    },
    methods: {
        showArea() {
            this.setData({
                isArea: !this.data.isArea
            })
            this.triggerEvent('onClose', {isArea: this.data.isArea})
        },
        areaCancel() {
            this.setData({
                isArea: true
            })
            this.triggerEvent('onClose', {isArea: this.data.isArea})
        },
        areaConfirm(e) {
            this.triggerEvent('areaConfirm', e)
        },
    }
})